<template>
    <div style="position: relative;">
      <img src="../assets/边框.png" style="width: 700px;">
      <div style="position: absolute; top:1%; left: 50%; transform: translate(-50%, -50%); font-size: 30px; color: #415058; font-weight: bold;">
        出勤情况
      </div>
      <div id="timeinschool" style="width: 460px; height: 400px;position: absolute; top:10%; left: 0%;"></div>
      <img src="../../static/sphereblue.png" style="position: absolute; top:12%; left: 71%">
      <div style="position: absolute; top:48%; left: 82%; transform: translate(-50%, -50%); font-size: 20px; color: #415058; font-weight: bold;">
        本周缺勤次数
      </div>
      <div style="font-size: 60px; color: #274AAA;position: absolute; top:17%; left: 79%">3</div>
      <img src="../../static/spherepink.png" style="position: absolute; top:55%; left: 71%">
      <div style="position: absolute; top:90%; left: 82%; transform: translate(-50%, -50%); font-size: 20px; color: #415058; font-weight: bold;">
        本周迟到次数
      </div>
      <div style="font-size: 60px; color: #C044A5;position: absolute; top:60%; left: 79%">2</div>
    </div>
  </template>

<script>
import * as echarts from 'echarts';
export default {
    
  mounted() {
    
    var chartDom = document.getElementById('timeinschool');
    var myChart = echarts.init(chartDom);
    var option;

    option = {
  color: ['#80FFA5', '#00DDFF', '#37A2FF', '#FF0087', '#FFBF00'],
  title: {
    text: '在校时长',
    top: 'top',
    left:'center'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'cross',
      label: {
        backgroundColor: '#6a7985'
      }
    }
  },
  legend: {
    data: ['本周', '上周','上上周'],
    top:'7%'
  },
  toolbox: {
    feature: {
      saveAsImage: {}
    },
    left:'90%'
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: [
    {
      type: 'category',
      boundaryGap: false,
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    }
  ],
  yAxis: [
    {
      type: 'value'
    }
  ],
  series: [
    {
      name: '本周',
      type: 'line',
      stack: 'Total',
      smooth: true,
      lineStyle: {
        width: 0
      },
      showSymbol: false,
      areaStyle: {
        opacity: 0.8,
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: 'rgb(128, 255, 165)'
          },
          {
            offset: 1,
            color: 'rgb(1, 191, 236)'
          }
        ])
      },
      emphasis: {
        focus: 'series'
      },
      data: [10.25, 7.93, 4.76, 12.11, 6.88, 9.34, 14.02]
    },
    {
      name: '上周',
      type: 'line',
      stack: 'Total',
      smooth: true,
      lineStyle: {
        width: 0
      },
      showSymbol: false,
      areaStyle: {
        opacity: 0.8,
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: 'rgb(0, 221, 255)'
          },
          {
            offset: 1,
            color: 'rgb(77, 119, 255)'
          }
        ])
      },
      emphasis: {
        focus: 'series'
      },
      data: [5.67, 11.45, 8.29, 3.78, 13.56, 6.45, 9.01]
    },
    {
      name: '上上周',
      type: 'line',
      stack: 'Total',
      smooth: true,
      lineStyle: {
        width: 0
      },
      showSymbol: false,
      areaStyle: {
        opacity: 0.8,
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: 'rgb(55, 162, 255)'
          },
          {
            offset: 1,
            color: 'rgb(116, 21, 219)'
          }
        ])
      },
      emphasis: {
        focus: 'series'
      },
      data: [4.33, 14.67, 7.89, 10.22, 5.11, 12.99, 8.76]
    },
    
  ]
};

option && myChart.setOption(option);
  }
};



</script>

<style>
#timeinschool {
  position: absolute;
  z-index: 1; /* 设置较高的 z-index 值 */
}
</style>